package com.todo.member.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/2/12 11:58
 * @description
 */
@Getter
@AllArgsConstructor
public enum MemberTaskClassifyEnum {

    NOVICE_TASK(1, "NOVICE_TASK", "新手任务"),
    DAILY_TASK(2, "DAILY_TASK", "日常任务"),
    ACTIVITY_TASK(3, "ACTIVITY_TASK", "活动任务"),
    HIDE_TASK(4, "HIDE_TASK", "隐藏任务"),
    UPGRADE_TASK(5, "UPGRADE_TASK", "升级任务"),
    ;

    private static Map<Integer, MemberTaskClassifyEnum> typeMap = Arrays
            .stream(MemberTaskClassifyEnum.values())
            .collect(Collectors.toMap(MemberTaskClassifyEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static MemberTaskClassifyEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
